home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 18
/
018.d81
/
comal #11
< prev
next >
Wrap
Text File
|
2022-08-26
|
6KB
|
301 lines
COMAL CORNER #11
===== ====== ===
written by: Joel Ellis Rea
I think I have finally figured out
why COMAL is such an easy language to
learn and use. Some languages (like
BASIC) are easy to learn but not easy
to use. Aside from the lack of access
to such C64 features as graphics, the
SID sound chip and sprites, the BASIC
language itself is just plain hard to
use. How many times have you looked
at a BASIC program listing that began
with something like:
10 GOSUB 1000
20 GOSUB 10000:ON C GOSUB 12000,
12500,11000:IF C<4 THEN 10
Sure, you may know what that line
means, but what does it DO? If that
is a program of any real size (say, 3
or more printer pages), you could have
a real headache by the time you trace
through the GOSUBs and get to the ON
GOTO!
In COMAL, on the other hand, the
above line might be coded:
0010 set'up
0020 REPEAT
0030 main'menu(choice$)
0040 CASE choice$ OF
0050 WHEN "L","l"
0060 load'sprite'shape
0070 WHEN "S","s"
0080 save'sprite'shape
0090 WHEN "E","e"
0100 edit'sprite'shape
0110 OTHERWISE
0120 NULL
0130 ENDCASE
0140 UNTIL choice$ IN "Qq"
Sure, it takes more lines, but even
though there are no comments, and even
though you have seen none of the sub-
routines (PROCedures in COMAL talk),
I'll bet you have a fair idea of what
kind of program those lines are from
even if you have never seen a COMAL
program before! In case you were won-
dering, yes, that is indeed equivalent
to the BASIC lines above.
Anyway, my point is that COMAL is
indeed "COMmon Algorithmic Language".
It, more than Pascal or even Modula-2,
is a language whose syntax "flows" the
way programmers think. Want proof?
In recent issues of Byte and other
magazines not dedicated to any partic-
ular system or language, authors and
letter writers alike often express
algorithms in terms of a "Pseudo-Code"
or "Program-Design Language" (PDL),
which is not a programming language
per se, but a way for programmers to
express algorithms on paper. Indeed,
"pseudo-coding" is an important step,
right after flowcharting, in profes-
sional program design. Many program-
mers who program in Pascal, etc., lay
out their logic in PDL before writing
a single line of Pascal.
Are you wondering what in the world
all this has to do with COMAL? Well,
PDL varies from person to person, but
the excerpts I have seen in articles
and letters are good examples of COMAL
syntax (except for minor variances,
such as how comments are delimited),
EVEN THOUGH THE AUTHOR HAS NEVER SEEN
OR HEARD OF COMAL!!! In other words,
COMAL IS PDL!!! A COMAL programmer
need not use a PDL step, he can lay
out his structure right on the screen,
then build the necessary blocks (PROC-
edures and FUNCtions) around it. Now
I know why Borge Christensen called it
"COMMON Algorithmic Language"!
Now for this month's features. In
COMAL TUTOR #5 we explore FUNCtions
in more detail, and introduce the con-
cept of PROCedures, COMAL's answer to
GOSUB, and check out PLAYNOTE'S
summaries of meetings of Comal users
on PlayNet. We have our first outside
COMAL Corner submission -- a set of
two very useful FUNCtions and one
very useful PROCedure (which can be
used in any version of COMAL). The
first FUNCtion converts a Gregorian
calendar date (month, day, year) into
a Julian day (not to be confused with
the Julian calendar of Julius Caeser).
The second FUNCtion converts a Julian
day back into a Gregorian date. The
last PROCedure computes the Arctangent
properly adjusted for quadrant
positions. The arguments are the X
and Y coordinates of the point. The
RETURNed value is the angle in Radians
that a vector to the given point would
make with the X-axis. Due to a recent
move of our editorial staff, the
origin of these routines has escaped
us. Would the rightful author please
notify us as soon as possible?
Speaking of which, I want to keep
COMAL Corner going for as long as I
can. Your comments through the STAR-
LINE help, but the editors of Loadstar
want to see more reader participation!
We have been going for more than half
a year with the Corner, and as of this
month we've had a grand total of ONE
user-submitted COMAL program or COMAL-
interest article! It's not enough to
just say you like COMAL Corner, please
write in!
Submissions to COMAL Corner may be
any of the following:
1. A self-written COMAL program.
2. A self-written set of COMAL sub-
programs (PROCs/FUNCs).
3. An article on COMAL or a COMAL-
related topic.
4. A review of a COMAL book or disk.
5. A letter commenting on this
series, showing a useful COMAL
technique, asking COMAL-rela-
ted questions, etc.
6. Anything else you can think of
that is in good taste, is not
copyrighted by another source,
and in some way relates to
COMAL.
Remember, Loadstar PAYS for user
submitted articles and programs that
meet our standards!
Before I forget, I do have a pro-
gram of my own this month. It is a
simulation of the path of a drunkard
(a great demonstration of COMAL Turtle
Graphics).
See you on PlayNET, Thursday nights
at 9:30 EDT in the COMAL Room. If you
have a modem, BE THERE! If you don't
have a modem, get one and BE THERE!
If you would like to run COMAL
\oad"comal tutor#5",8
TUTOR now, please press the '\' key.
---------< end of article >-----------